/////////////////////////////////////////////////////////////////////////////
// Name:        SettingsDialog2.cpp
// Purpose:     
// Author:      yospaly
// Modified by: 
// Created:     07/01/2009 16:25:13
// RCS-ID:      
// Copyright:   Copyright (C) 2008, yospaly
// Licence:     
/////////////////////////////////////////////////////////////////////////////

// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"

#ifdef __BORLANDC__
#pragma hdrstop
#endif

#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif

////@begin includes
#include "wx/bookctrl.h"
////@end includes

#include "SettingsDialog2.h"

////@begin XPM images

////@end XPM images


/*!
 * SettingsDialog type definition
 */

IMPLEMENT_DYNAMIC_CLASS( SettingsDialog, wxDialog )


/*!
 * SettingsDialog event table definition
 */

BEGIN_EVENT_TABLE( SettingsDialog, wxDialog )

////@begin SettingsDialog event table entries
    EVT_WINDOW_DESTROY( SettingsDialog::OnDestroy )

    EVT_TREE_SEL_CHANGED( ID_MIRRORS_TREE, SettingsDialog::OnMIRRORSTREESelChanged )

////@end SettingsDialog event table entries

END_EVENT_TABLE()


/*!
 * SettingsDialog constructors
 */

SettingsDialog::SettingsDialog()
{
    Init();
}

SettingsDialog::SettingsDialog( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
{
    Init();
    Create(parent, id, caption, pos, size, style);
}


/*!
 * SettingsDialog creator
 */

bool SettingsDialog::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
{
////@begin SettingsDialog creation
    SetExtraStyle(wxWS_EX_VALIDATE_RECURSIVELY|wxWS_EX_BLOCK_EVENTS);
    SetSheetStyle(wxPROPSHEET_DEFAULT);
    wxDialog::Create( parent, id, caption, pos, size, style );

    CreateButtons(wxOK|wxCANCEL);
    CreateControls();
    LayoutDialog();
    Centre();
////@end SettingsDialog creation
    return true;
}


/*!
 * SettingsDialog destructor
 */

SettingsDialog::~SettingsDialog()
{
////@begin SettingsDialog destruction
////@end SettingsDialog destruction
}


/*!
 * Member initialisation
 */

void SettingsDialog::Init()
{
////@begin SettingsDialog member initialisation
    p_mirrors_tree = NULL;
    p_mirror_text = NULL;
    p_mount_info_static = NULL;
////@end SettingsDialog member initialisation
}


/*!
 * Control creation for SettingsDialog
 */

void SettingsDialog::CreateControls()
{    
////@begin SettingsDialog content construction
    SettingsDialog* itemDialog1 = this;

    wxPanel* itemPanel2 = new wxPanel( GetBookCtrl(), ID_PANEL1, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxTAB_TRAVERSAL );
    wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxVERTICAL);
    itemPanel2->SetSizer(itemBoxSizer3);

    p_mirrors_tree = new wxTreeCtrl( itemPanel2, ID_MIRRORS_TREE, wxDefaultPosition, itemPanel2->ConvertDialogToPixels(wxSize(240, 150)), wxTR_HAS_BUTTONS |wxTR_TWIST_BUTTONS|wxTR_FULL_ROW_HIGHLIGHT|wxTR_LINES_AT_ROOT|wxTR_HIDE_ROOT|wxTR_ROW_LINES|wxTR_HAS_VARIABLE_ROW_HEIGHT|wxTR_SINGLE|wxSUNKEN_BORDER );
    itemBoxSizer3->Add(p_mirrors_tree, 1, wxGROW|wxALL, 0);

    wxStaticText* itemStaticText5 = new wxStaticText( itemPanel2, wxID_STATIC, _("Select a mirror from mirrors list or input\ncustom mirror location, ie:\n  *  http://any.web-server.com/cygwin/\n  *  ftp://any.ftp-server.com/cygwin/\n  *  \\\\lan-share\\cygwin\n  *  D:\\download\\cygwin"), wxDefaultPosition, wxDefaultSize, 0 );
    itemStaticText5->SetFont(wxFont(9, wxSWISS, wxNORMAL, wxNORMAL, false, wxT("Courier New")));
    itemBoxSizer3->Add(itemStaticText5, 0, wxGROW|wxALL, 5);

    wxBoxSizer* itemBoxSizer6 = new wxBoxSizer(wxHORIZONTAL);
    itemBoxSizer3->Add(itemBoxSizer6, 0, wxGROW|wxALL, 0);
    wxStaticText* itemStaticText7 = new wxStaticText( itemPanel2, wxID_STATIC, _("Location :"), wxDefaultPosition, wxDefaultSize, 0 );
    itemBoxSizer6->Add(itemStaticText7, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);

    p_mirror_text = new wxTextCtrl( itemPanel2, ID_MIRROR_TEXT, _T(""), wxDefaultPosition, wxDefaultSize, 0 );
    itemBoxSizer6->Add(p_mirror_text, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5);

    GetBookCtrl()->AddPage(itemPanel2, _("Mirrors"));

    wxPanel* itemPanel9 = new wxPanel( GetBookCtrl(), ID_PANEL2, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxTAB_TRAVERSAL );
    wxBoxSizer* itemBoxSizer10 = new wxBoxSizer(wxVERTICAL);
    itemPanel9->SetSizer(itemBoxSizer10);

    p_mount_info_static = new wxStaticText( itemPanel9, wxID_STATIC, _("Static text"), wxDefaultPosition, wxDefaultSize, 0 );
    itemBoxSizer10->Add(p_mount_info_static, 1, wxGROW|wxALL, 5);

    GetBookCtrl()->AddPage(itemPanel9, _("Information"));


    // Connect events and objects
    itemDialog1->Connect(ID_SETTINGS_DLG2, wxEVT_DESTROY, wxWindowDestroyEventHandler(SettingsDialog::OnDestroy), NULL, this);
////@end SettingsDialog content construction
}


/*!
 * wxEVT_DESTROY event handler for ID_SETTINGS_DLG2
 */

void SettingsDialog::OnDestroy( wxWindowDestroyEvent& event )
{
////@begin wxEVT_DESTROY event handler for ID_SETTINGS_DLG2 in SettingsDialog.
    // Before editing this code, remove the block markers.
    event.Skip();
////@end wxEVT_DESTROY event handler for ID_SETTINGS_DLG2 in SettingsDialog. 
}


/*!
 * wxEVT_COMMAND_TREE_SEL_CHANGED event handler for ID_MIRRORS_TREE
 */

void SettingsDialog::OnMIRRORSTREESelChanged( wxTreeEvent& event )
{
////@begin wxEVT_COMMAND_TREE_SEL_CHANGED event handler for ID_MIRRORS_TREE in SettingsDialog.
    // Before editing this code, remove the block markers.
    event.Skip();
////@end wxEVT_COMMAND_TREE_SEL_CHANGED event handler for ID_MIRRORS_TREE in SettingsDialog. 
}


/*!
 * Should we show tooltips?
 */

bool SettingsDialog::ShowToolTips()
{
    return true;
}

/*!
 * Get bitmap resources
 */

wxBitmap SettingsDialog::GetBitmapResource( const wxString& name )
{
    // Bitmap retrieval
////@begin SettingsDialog bitmap retrieval
    wxUnusedVar(name);
    return wxNullBitmap;
////@end SettingsDialog bitmap retrieval
}

/*!
 * Get icon resources
 */

wxIcon SettingsDialog::GetIconResource( const wxString& name )
{
    // Icon retrieval
////@begin SettingsDialog icon retrieval
    wxUnusedVar(name);
    return wxNullIcon;
////@end SettingsDialog icon retrieval
}
